﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace demo08
{
    class Program8
    {
        static void Main(string[] args)
        {
            bool flag = true;
            int a = 0;

            while (flag)
            {
                try
                {
                    Console.WriteLine("请输入正方形边长：");
                    a = Convert.ToInt32(Console.ReadLine());
                    flag = false;
                }
                catch
                {
                    Console.WriteLine("输入的不是整数，请重新输入");
                }
            }

            for (int i = 0; i < a; i++)
            {
                for (int j = 0; j < a; j++)
                {
                    Console.Write(" *");
                }
                Console.WriteLine();
            }
            Console.ReadKey();
        }
    }
}
